/**
 * jquery-model.js
 * author  brose
 *
 **/
;(function (o) {
    o.fn.extend({
        modelDriver: function (obj) {
            var $this = this,
                setting = obj || {};
            $this.find("[data-model]").each(function ($index, $item) {
                var $item = $(item),
                    _nodeName = item.nodeName,
                    _modelName = $item.attr("data-model");
                for (var i in setting) {
                    if (i === _modelName) {
                        if (_nodeName === "INPUT" || _nodeName === "SELECT") {
                            $item.val(obj[i]);
                        } else {
                            $item.text(obj[i]);
                        }
                    }
                }
            })

        }
    });
})(window.$ || jQuery);
